<?php
/**
 * Class link to table master_course_type in database
 *
 * @author Dat Nguyen <datnt@evolable.asia>
 */
class CourseType extends AppModel {
	var $name = 'CouseType';
	var $useTable = 'course_type';
	var $tablePrefix = 'master_';
	var $primaryKey = 'id';
	var $displayField = 'type';
	var $order = 'rank asc';

	/**
	 * Get area that belong to course
	 *
	 * @param $course
	 * @return array
	 */
	function getByCourse ($course) {
		$options = array(
			'conditions' => array(),
			'recursive' => -1,
		);
		if (isset($course['Course']['course_type'])) {
			$options['conditions'] = array(
				'id' => $course['Course']['course_type'],
			);
		}
		return $this->find('first', $options);
	}
}